<?php

namespace backend\controllers\order;

use app\models\Order;
use app\models\Orderitem;
use backend\components\ResponseJson;
use yii\data\ActiveDataProvider;
use yii\data\ArrayDataProvider;
use yii\helpers\ArrayHelper;

class OrderItemController extends \yii\web\Controller
{

    use ResponseJson;

    public function actionIndex()
    {
        $model = new Orderitem();
        $query = Orderitem::find()->where(['order_id'=>632214])->asArray()->all();
        // Active数据提供者
//        $provider = new ActiveDataProvider([
//            'query'=>$query
//        ]);
        // Array 数据提供者
        $provider = new ArrayDataProvider([
            'allModels'=>$query
        ]);
        $list = $provider->getModels();
//        return $this->jsonOutput($list);
        return $this->render('index', ['list'=>$list, 'model'=>$model]);
    }

}
